﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FinScreen.Util;
using SmartQuant.Series;
using SmartQuant.Indicators;
using SmartQuant.Data;
using FinScreen.Model;

namespace FinScreen.Analyzers
{
    [Strategy("Simple by MA", FinScreen.StrategyEnum.Buy)]
    class SimpleBuyStrategy : Strategy
    {
        private static readonly string[] EXPECTED_INDUSTRIES =
            new string[] { "互联网", "出版业", "银行", "石油开采", "证券", "生物制药", "软件服务", "港口", "区域地产", "综合类", "家用电器", "超市连锁" };

        public override IEnumerable<Instrument> Instrument(StrategyContext context)
        {
            return null;
            //if (
            //      instrument.PEG.Between(5, 120)
            //       && EXPECTED_INDUSTRIES.Contains(instrument.Industry)
            //      )
            //{
            //    TimeSeries tsclose = new TimeSeries();
            //    foreach (var quote in instrument.Quotes)
            //        tsclose.Add(quote.TS, (double)quote.Close);

            //    EMA[] emas = new EMA[3];
            //    emas[0] = new EMA(tsclose, 5, BarData.Close);
            //    emas[1] = new EMA(tsclose, 10, BarData.Close);
            //    emas[2] = new EMA(tsclose, 20, BarData.Close);

            //    foreach (var ema in emas)
            //        ema.Calculate(true);

            //    if (
            //        emas[0].Last >= emas[1].Last
            //        && emas[1].Last >= emas[2].Last
            //        )
            //        OnChoose(instrument);
            //}
        }

        public override void OnMarket(QuantBox.CSharp2CTPZQ.CThostFtdcDepthMarketDataField data)
        {
            throw new NotImplementedException();
        }
    }
}